import { BaseRequestConfig, BaseResponse } from '@/core/type';

export type DataType = 'json' | 'text' | 'base64' | 'arraybuffer';

export type CorsMode = 'no-cors' | 'cors' | 'same-origin';
export type Credentials = 'include' | 'same-origin' | 'omit';
export type Cache = 'default' | 'no-cache' | 'reload' | 'force-cache' | 'only-if-cached';
export interface CallbackResult {
    /** 错误信息 */
    errMsg: string;
}
export interface RequestConfig extends BaseRequestConfig {
    dataType?: DataType;
    enableCookie?: boolean;
    mode?: CorsMode;
    credentials?: Credentials;
    cache?: Cache;
    retryTimes?: number;
    enableHttp2?: boolean;
    [x: string]: any;
}

export interface ResponseResult extends BaseResponse {
    cookies?: string[];
    config?: RequestConfig;
}
